/* Common styles */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    color: #f3f4f6;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit; /* Ensure all elements respect the border-box model */
}

/* Full-screen background */
.full-bg {
    background-image: url('imgs/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* This makes the background fixed */
    height: 100vh; /* Ensures it covers the full viewport height */
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem 1rem 3rem;
    position: relative;
    overflow-x: hidden;
}


/* Animation for page elements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search box container */
.search-container {
    position: relative;
    width: 80%;
    max-width: 500px;
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Search input styling */
.search-input {
    width: 100%;
    padding: 1.2rem 3.5rem 1.2rem 1.8rem;
    border-radius: 30px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    background-color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
    background-color: rgba(255, 255, 255, 0.98);
}

/* Search icon styling */
.search-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    cursor: pointer;
    color: #111827;
    transition: transform 0.3s ease, color 0.3s ease;
    padding: 10px;
    border-radius: 50%;
}

.search-icon:hover {
    transform: translateY(-50%) scale(1.1);
    color: #4f46e5;
}

/* Image upload container (hidden initially) */
.upload-container {
    background-color: rgba(31, 41, 55, 0.92);
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    display: none;
    margin-bottom: 3rem;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    animation: fadeInUp 0.5s ease-out forwards;
    transform: translateY(10px);
    opacity: 0;
}

.upload-container.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.8rem;
    text-align: center;
    color: #f9fafb;
}

.file-input {
    margin-bottom: 1.2rem;
    width: 100%;
    color: #f3f4f6;
    background-color: rgba(55, 65, 81, 0.5);
    padding: 0.8rem;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 2px dashed rgba(156, 163, 175, 0.5);
    transition: all 0.3s ease;
}

.file-input:hover {
    background-color: rgba(55, 65, 81, 0.7);
    border-color: rgba(156, 163, 175, 0.8);
}

.image-preview {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    margin: 1.2rem 0;
    border-radius: 0.75rem;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(75, 85, 99, 0.3);
    background-color: rgba(31, 41, 55, 0.5);
    transition: all 0.3s ease;
}

.submit-button {
    background-color: #4f46e5;
    color: white;
    font-weight: bold;
    padding: 0.9rem 1.5rem;
    border-radius: 30px;
    width: 100%;
    cursor: pointer;
    border: none;
    margin-top: 1.2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.submit-button:hover {
    background-color: #4338ca;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4);
}

.submit-button:active {
    transform: translateY(0);
}

.loader {
    margin-top: 1.2rem;
    text-align: center;
    color: #8b5cf6;
    display: none;
    font-weight: 600;
    animation: pulse 1.5s infinite;
}

.api-status {
    margin-top: 0.8rem;
    text-align: center;
    color: #60a5fa;
    display: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: rgba(55, 65, 81, 0.3);
    animation: fadeInUp 0.3s ease-out forwards;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.result {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    padding: 1rem;
    border-radius: 0.75rem;
    background-color: rgba(55, 65, 81, 0.5);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Placeholder result styles */
.placeholder-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: left;
}

.placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    animation: pulse 2s infinite;
}

.placeholder-message {
    font-size: 1rem;
    width: 100%;
}

.placeholder-message p {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: #f9fafb;
    text-align: center;
}

.placeholder-details {
    display: block;
    font-weight: normal;
    font-size: 0.9rem;
    color: #d1d5db;
    margin-bottom: 0.5rem;
}

.placeholder-list {
    margin: 0.5rem 0 0 1.5rem;
    padding: 0;
    font-size: 0.85rem;
    color: #abb3c0;
    font-weight: normal;
}

.placeholder-list li {
    margin-bottom: 0.25rem;
}

/* API development mode styles */
.api-response-details {
    background-color: rgba(17, 24, 39, 0.5);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    border: 1px solid rgba(79, 70, 229, 0.3);
}

.api-detail {
    display: flex;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.api-detail:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: #a5b4fc;
    width: 95px;
    flex-shrink: 0;
}

.detail-value {
    color: #e5e7eb;
}

.development-note {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-left: 3px solid #8b5cf6;
    background-color: rgba(139, 92, 246, 0.1);
    font-size: 0.85rem;
    color: #d1d5db;
    border-radius: 0 0.25rem 0.25rem 0;
}

.development-note strong {
    color: #a5b4fc;
}

/* Media queries for responsiveness */
@media (max-width: 640px) {
    .search-container {
        width: 95%; /* Increased from 90% */
        max-width: 100%;
    }
    
    .upload-container {
        width: 95%; /* Increased from 90% */
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .title {
        font-size: 1.25rem;
    }
    
    .navbar-links {
        gap: 0.75rem;
    }
    
    .navbar-logo {
        font-size: 1.1rem;
        max-width: 60%;
    }
    
    .doc-title {
        font-size: 1.75rem;
    }
    
    .submit-button {
        padding: 0.75rem 1rem;
    }
    
    .doc-main {
        width: 95%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 0.9rem; /* Slightly reduce base font size */
    }

    .full-bg {
        padding: 4rem 0.5rem 2rem; /* Reduced side padding */
    }

    .search-input {
        padding: 0.75rem 2.5rem 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .navbar {
        padding: 0.5rem;
    }
    
    .upload-container {
        padding: 1.25rem 1rem;
        width: 98%; /* Even wider on very small screens */
        border-radius: 0.75rem;
    }
    
    .submit-button {
        padding: 0.6rem 1rem;
    }
    
    .doc-main {
        padding: 1rem;
    }
    
    .search-icon {
        right: 1rem;
        font-size: 1.1rem;
    }
    
    .result {
        font-size: 1.2rem;
        padding: 0.75rem;
    }
    
    .file-input {
        padding: 0.6rem;
    }
}

@media (max-width: 380px) {
    .navbar {
        flex-direction: column;
        padding: 0.5rem 0.25rem;
        gap: 0.25rem;
    }
    
    .navbar-logo {
        font-size: 1rem;
        text-align: center;
        margin-bottom: 0.25rem;
        max-width: 100%;
    }
    
    .navbar-links {
        width: 100%;
        justify-content: center;
    }
    
    .search-input {
        padding: 0.75rem 2rem 0.75rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .title {
        font-size: 1rem;
        margin-bottom: 1.2rem;
    }
    
    .search-container {
        margin-bottom: 2rem;
    }
    
    .upload-container {
        padding: 1rem 0.75rem;
    }
    
    .full-bg {
        justify-content: center;
        padding-top: 5rem; /* Increase padding-top to account for taller navbar */
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .full-bg {
        padding-top: 4rem;
        padding-bottom: 1rem;
        justify-content: flex-start;
    }
    
    .search-container {
        margin-bottom: 1rem;
        margin-top: 1rem;
    }
    
    .upload-container {
        max-height: 80vh;
        overflow-y: auto;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .image-preview {
        max-height: 150px;
    }
    
    .navbar {
        height: auto;
        min-height: 2.5rem;
    }
}

/* Ensure touch targets are large enough */
@media (hover: none) and (pointer: coarse) {
    .navbar-link, .search-icon, .submit-button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Gradient animation */
@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animate-gradient {
    background: linear-gradient(270deg, #4f46e5, #0ea5e9, #4338ca);
    background-size: 600% 600%;
    animation: gradientShift 8s ease infinite;
}

/* Animation for result display */
@keyframes highlightResult {
    0% { background-color: rgba(79, 70, 229, 0.3); }
    50% { background-color: rgba(79, 70, 229, 0.1); }
    100% { background-color: rgba(55, 65, 81, 0.5); }
}

.result-highlight {
    animation: highlightResult 2s ease-out forwards;
}

/* Index page styles */
.main-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    padding-top: 4rem;
}

.card {
    background-color: rgba(31, 41, 55, 0.8);
    padding: 1.5rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 28rem;
}

.card-title {
    font-size: 1.875rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-align: center;
}

.card-description {
    margin-bottom: 1.5rem;
    text-align: center;
    color: #9ca3af;
}

.file-input {
    margin-bottom: 1rem;
    display: block;
    width: 100%;
}

.image-preview {
    margin-bottom: 1rem;
    width: 100%;
    height: auto;
    border-radius: 0.375rem;
    border: 1px solid #374151;
    display: none;
}

.submit-button {
    background-color: #4b5563;
    color: white;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    width: 100%;
    cursor: pointer;
    border: none;
}

.submit-button:hover {
    background-color: #6b7280;
}

.loader {
    margin-top: 1rem;
    text-align: center;
    color: #a855f7;
    display: none;
}

.result {
    margin-top: 1rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Documentation page styles */
.doc-body {
    background-color: #111827;
    padding: 1rem;
    padding-top: 4rem;
}

.doc-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.doc-title {
    font-size: 2.25rem;
    font-weight: bold;
}

.doc-subtitle {
    color: #9ca3af;
    margin-top: 0.5rem;
}

.doc-main {
    max-width: 48rem;
    margin: 0 auto;
    background-color: #1f2937;
    padding: 1.5rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.doc-section {
    margin-bottom: 1.5rem;
}

.doc-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.doc-text {
    color: #d1d5db;
}

.doc-list {
    list-style-type: disc;
    list-style-position: inside;
    color: #d1d5db;
}

/* Navbar styles */
.navbar {
    background-color: rgba(17, 24, 39, 0.9);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: auto; /* Changed from fixed height to auto */
    min-height: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    padding: 0.5rem 1rem; /* Simplified padding */
    backdrop-filter: blur(10px);
    flex-wrap: wrap; /* Allow wrapping on very small screens */
}

.navbar-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f3f4f6;
    text-decoration: none;
    padding: 0.25rem 0;
}

.navbar-links {
    width: auto; /* Changed from percentage to auto */
    position: relative;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    justify-content: flex-end;
}

.navbar-link {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-link:hover {
    color: #60a5fa;
}

.navbar-link.active {
    color: #60a5fa;
    font-weight: 700;
}

/* Hamburger menu button (hidden by default) */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1050;
    position: relative;
}

.hamburger-btn span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #f3f4f6;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Side navbar styles */
.side-navbar {
    position: fixed;
    top: 0;
    right: -250px; /* Start offscreen */
    width: 250px;
    height: 100vh;
    background-color: rgba(17, 24, 39, 0.97);
    z-index: 1040;
    transition: right 0.3s ease;
    padding-top: 4rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.side-navbar.open {
    right: 0;
}

.side-navbar-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
}

.side-navbar-link {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.side-navbar-link:hover {
    color: #60a5fa;
    background-color: rgba(55, 65, 81, 0.5);
    border-radius: 0.3rem;
}

.side-navbar-link.active {
    color: #60a5fa;
    font-weight: 700;
}

/* Overlay for when side navbar is open */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1030;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.open {
    display: block;
    opacity: 1;
}

/* Animation for hamburger to X */
.hamburger-btn.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger-btn.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Media queries for responsive design */
@media (max-width: 768px) {
    .navbar-links {
        display: none; /* Hide regular navbar on mobile */
    }
    
    .hamburger-btn {
        display: flex; /* Show hamburger on mobile */
    }
}

/* Remove the old nav-link since we have navbar now */
.nav-link {
    display: none;
}
